package com.diy.sigmund.diygateway;

import com.diy.sigmund.diycommon.spring.aspect.ControllerLogAspect;
import org.redisson.spring.starter.RedissonAutoConfiguration;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.cloud.netflix.zuul.EnableZuulProxy;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScan.Filter;
import org.springframework.context.annotation.FilterType;

/**
 * 在Spring Boot主函数上通过注解 @EnableZuulProxy 来开启, 这样可以让本地的请求转发到适当的服务
 *
 * @author ylm-sigmund
 * @since 2021/8/31 21:10
 */
@EnableZuulProxy
@SpringBootConfiguration
// 排除DataSourceAutoConfiguration，避免启动时校验jdbc url
@EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class, RedissonAutoConfiguration.class})
// 排除ControllerLogAspect，避免打印控制层日志/actuator/health
@ComponentScan(basePackages = {"com.diy.sigmund.diygateway", "com.diy.sigmund.diycommon.middleware.cache.redis"},
        excludeFilters = @Filter(type = FilterType.ASSIGNABLE_TYPE,
                classes = {ControllerLogAspect.class}))
public class DiyGatewayApplication {

    public static void main(String[] args) {
        SpringApplication.run(DiyGatewayApplication.class, args);
    }
}
